import { createRouter, createWebHistory } from 'vue-router'
import commonRoute from './modules/common.js'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: commonRoute,
  // 滚动行为
  scrollBehavior() {
    return {
      left: 0,
      top: 0,
    }
  }
})
router.afterEach((to) => {
  if (to.meta.title) {
    document.title = to.meta.title
  } else {
    document.title = 'VUE3代码管理'
  }
})

export default router
